home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / ip / dns / ddt2.0 / cmd / hosts-addr < prev    next >
Encoding:
Text File  |  1993-05-17  |  1.3 KB  |  43 lines

  1. #!/usr/local/bin/perl
  2. #
  3. #  hosts-addr - prints host names and IP addresses contained in A RR's. 
  4. #               The names should be absolute (see expand)
  5. #
  6. #  Copyright (C) 1992, 1993 PUUG - Grupo Portugues de Utilizadores
  7. #                                  do Sistema UNIX
  8. #                1992, 1993 FCCN - Fundacao para o Desenvolvimento dos Meios 
  9. #                                  Nacionais de Calculo Cientifico 
  10. #
  11. #  Authors: Jorge Frazao de Oliveira <frazao@puug.pt>
  12. #           Artur Romao <artur@dns.pt>
  13. #
  14. #  This file is part of the DDT package, Version 2.0.
  15. #
  16. #  Permission to use, copy, modify, and distribute this software and its 
  17. #  documentation for any purpose and without any fee is hereby granted, 
  18. #  provided that the above copyright notice appear in all copies.  Neither 
  19. #  PUUG nor FCCN make any representations about the suitability of this
  20. #  software for any purpose.  It is provided "as is" without express or 
  21. #  implied warranty.
  22.  
  23.  
  24. $[ = 1;            # set array base to 1
  25. $, = ' ';               # set output field separator
  26. $\ = "\n";              # set output record separator
  27.  
  28. while (<STDIN>) {
  29.         if (/\tA\t/) {
  30.             chop;        # strip record separator
  31.             @Field = split(/\s+/, $_);
  32.  
  33.         $host_addr{$Field[1], $Field[$#Field]} = 1;
  34.         }
  35. }
  36.  
  37. foreach $h (keys %host_addr) {
  38.         @ha = split($;, $h);
  39.  
  40.     print "$ha[1]\t$ha[2]";
  41. }
  42.  
  43.